/////precompiled////////
#include "precompiled.h"
////////////////////////


#include "prs_GrfRect.h"
using namespace prs;
              
// TRuleGrfRect ///////////////////////////////////////////////////////////////

//
TRuleGrfRect::TRuleGrfRect(snt::text::TContext &SntContext,svl::TVariant &VRect) 
:vRect(VRect)
{
  snt::TFVoid          F;
  snt::TReturn         Return;
  snt::text::TSequence T(SntContext);
  snt::text::TNumber   N(SntContext);

  vThis = this;

  this->Name(GetClassName())
  | A.New()
  ;
  A.Name(GetClassName() + "[A]")
  | T.New("left")   & T.New("=") & N.New(vNumber) & F.New(FLeft  ,vThis,vNumber) & A.New()
  | T.New("top")    & T.New("=") & N.New(vNumber) & F.New(FTop   ,vThis,vNumber) & A.New()
  | T.New("width")  & T.New("=") & N.New(vNumber) & F.New(FWidth ,vThis,vNumber) & A.New()
  | T.New("height") & T.New("=") & N.New(vNumber) & F.New(FHeight,vThis,vNumber) & A.New()
  | Return.New(GetClassName() + "[A]")
  ;
}

//
grf::TRect &TRuleGrfRect::GetRect()
{
  grf::TRect *Rect = dynamic_cast<grf::TRect*>(vRect.Pointer()); 
  
  if (!Rect) { 
    Except("GetRect[!Rect]");
  }
  return *Rect;
}
